Skip to content

chore(sarif): Bump go-sarif version#3074

Merged
javirln merged 1 commit intochainloop-dev:mainfrom
javirln:feat/pfm-5693
Apr 24, 2026
Merged

chore(sarif): Bump go-sarif version#3074
javirln merged 1 commit intochainloop-dev:mainfrom
javirln:feat/pfm-5693

Conversation

@javirln
Copy link
Copy Markdown
Member

@javirln javirln commented Apr 24, 2026

This pull request updates the handling of SARIF files in the attestation crafter, improving compatibility with SARIF v3, enhancing annotation extraction, and updating dependencies accordingly. It also refines test cases and adds a new SARIF test file.

Dependency updates:

  • Updated to use github.com/owenrumney/go-sarif/v3 (v3.3.0) instead of the older v1.1.1, and changed import paths in sarif.go to match the new version. [1] [2] [3]
  • Added github.com/xeipuuv/gojsonschema v1.2.0 as an indirect dependency.

SARIF file handling improvements:

  • Improved error handling in Craft() for SARIF files by including the underlying error in the returned message and clarifying schema validation.
  • Refactored annotation extraction in injectAnnotations() to handle pointer fields and missing data safely, ensuring tool name and version are correctly extracted from SARIF v3 files.

Testing improvements:

  • Updated test structure in sarif_test.go to allow for expected digest and name assertions, and removed an outdated test case. [1] [2] [3]
  • Added a new SARIF test file with control characters to testdata for more robust test coverage.

@javirln javirln requested review from jiparis and migmartri April 24, 2026 06:17
@javirln javirln self-assigned this Apr 24, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="pkg/attestation/crafter/materials/sarif.go">

<violation number="1" location="pkg/attestation/crafter/materials/sarif.go:155">
P1: Guard `run.tool` and `run.tool.driver` before dereferencing to avoid a panic on partially populated SARIF runs.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread pkg/attestation/crafter/materials/sarif.go Outdated
Copy link
Copy Markdown
Member

@migmartri migmartri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried that this will become a precedent of us modifying a file before uploading it, changing digest, can't we fix the generator instead?

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln
Copy link
Copy Markdown
Member Author

javirln commented Apr 24, 2026

I am worried that this will become a precedent of us modifying a file before uploading it, changing digest, can't we fix the generator instead?

We definitely don't modify any incoming file, I'll revert those changes

@javirln javirln merged commit 1ce3922 into chainloop-dev:main Apr 24, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants